#include "stdafx.h"
#include "ViewYourFileView.h"

//
//CViewYourFileView::CViewYourFileView(void)
//{
//}
//
//
//CViewYourFileView::~CViewYourFileView(void)
//{
//}
//
//
//// ViewYourImageView.cpp : implementation of the CViewYourFileView class
////
//
//#include "stdafx.h"
//// SHARED_HANDLERS can be defined in an ATL project implementing preview, thumbnail
//// and search filter handlers and allows sharing of document code with that project.
//#ifndef SHARED_HANDLERS
//#include "ViewYourImage.h"
//#endif
//
//#include "ViewYourImageDoc.h"
//#include "ViewYourImageView.h"
//
//#include "global.h"
//#include "common_def.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CViewYourFileView

IMPLEMENT_DYNCREATE(CViewYourFileView, CFormView)

BEGIN_MESSAGE_MAP(CViewYourFileView, CFormView)
	ON_WM_CONTEXTMENU()
	ON_WM_RBUTTONUP()
	ON_WM_PAINT()
	ON_WM_SIZE()
	ON_BN_CLICKED(IDC_BUTTON_1, &CViewYourFileView::OnBnClickedButton1)
	ON_BN_CLICKED(IDC_BUTTON2, &CViewYourFileView::OnBnClickedButton2)
END_MESSAGE_MAP()

// CViewYourFileView construction/destruction

CViewYourFileView::CViewYourFileView()
	: CFormView(CViewYourFileView::IDD)
{

	
}

CViewYourFileView::~CViewYourFileView()
{

}

//BOOL CViewYourFileView::PreCreateWindow(CREATESTRUCT& cs)
//{
//	// TODO: Modify the Window class or styl
//}

//CViewYourFileView::~CViewYourFileView()
//{
//}

void CViewYourFileView::DoDataExchange(CDataExchange* pDX)
{
	CFormView::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_MFCSHELLLIST1, m_nMFCShellListCtrl);
}

BOOL CViewYourFileView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs
	//sShowWindow(SW_MAXIMIZE);
	return CFormView::PreCreateWindow(cs);
}



void CViewYourFileView::OnInitialUpdate()
{
	CFormView::OnInitialUpdate();
	GetParentFrame()->RecalcLayout();
	
}

void CViewYourFileView::OnRButtonUp(UINT /* nFlags */, CPoint point)
{
	ClientToScreen(&point);
	OnContextMenu(this, point);
}

void CViewYourFileView::OnContextMenu(CWnd* /* pWnd */, CPoint point)
{
#ifndef SHARED_HANDLERS
//	theApp.GetContextMenuManager()->ShowPopupMenu(IDR_POPUP_EDIT, point.x, point.y, this, TRUE);
#endif
}


// CViewYourFileView diagnostics

#ifdef _DEBUG
void CViewYourFileView::AssertValid() const
{
	CFormView::AssertValid();
}

void CViewYourFileView::Dump(CDumpContext& dc) const
{
	CFormView::Dump(dc);
}

//CViewYourImageDoc* CViewYourFileView::GetDocument() const // non-debug version is inline
//{
//	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CViewYourImageDoc)));
//	return (CViewYourImageDoc*)m_pDocument;
//}
#endif //_DEBUG


// CViewYourFileView message handlers


void CViewYourFileView::OnPaint()
{
	CPaintDC dc(this); // device context for painting

}


void CViewYourFileView::OnSize(UINT nType, int cx, int cy)
{
	CFormView::OnSize(nType, cx, cy);
	RedrawWindow();

	// TODO: Add your message handler code here
}


void CViewYourFileView::OnBnClickedButton1()
{
	// TODO: Add your control notification handler code here
	HRESULT hresult;
	TCHAR Path[] = L"C:\\Program Files";
	LPCTSTR lpszPath= Path;
	hresult = m_nMFCShellListCtrl.DisplayFolder( lpszPath );
	if ( hresult != S_OK )
	{
		MessageBox(L"NOT OK", L"Not ok" );
	}
}


void CViewYourFileView::OnBnClickedButton2()
{
	// TODO: Add your control notification handler code here
	LPCTSTR lpszPath= _T("C:\Program Files\Microsoft");
	m_nMFCShellListCtrl.DisplayFolder( _T("C:\\Program Files\\Microsoft") );
}
